local jiaowang = fk.CreateSkill {
  name = "rmt__jiaowang",
  tags = { Skill.Compulsory },
}

Fk:loadTranslationTable{
  ["rmt__jiaowang"] = "骄妄",
  [":rmt__jiaowang"] = "锁定技，你的起始手牌标记为“大嘴”且不计入手牌上限。你使用基本牌或普通锦囊牌时，每满足一项便多结算一次：1.指定非群势力角色为目标；2.实体牌含有“大嘴”。",

  ["@@rmt__jiaowang"] = "大嘴",

  ["$rmt__jiaowang1"] = "剑顾四野，马踏青山，今谁堪敌手？",
  ["$rmt__jiaowang2"] = "并土四州，带甲百万，吾可居大否？",
}

jiaowang:addEffect(fk.CardUsing, {
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(self) and (data.card.type == Card.TypeBasic or data.card:isCommonTrick()) and 
      data.tos and #data.tos > 0 and (table.find(data.tos, function(p) return p.kingdom ~= "qun" end) or
      (not data.card:isVirtual() and data.card:getMark("@@rmt__jiaowang") ~= 0) or
      (data.card:isVirtual() and #data.card.subcards > 0 and table.find(data.card.subcards, function(id) return
      Fk:getCardById(id):getMark("@@rmt__jiaowang") ~= 0 end)))
  end,
  on_use = function(self, event, target, player, data)
    if data.tos and #data.tos > 0 then
      local x = 0
      if table.find(data.tos, function(p) return p.kingdom ~= "qun" end) then
        x = x + 1
      end
      if not data.card:isVirtual() and data.card:getMark("@@rmt__jiaowang") ~= 0 then
        x = x + 1
      elseif data.card:isVirtual() and #data.card.subcards > 0 and table.find(data.card.subcards, function(id) return
      Fk:getCardById(id):getMark("@@rmt__jiaowang") ~= 0 end) then
        x = x + 1
      end
      data.additionalEffect = (data.additionalEffect or 0) + x
    end
  end,
})

jiaowang:addEffect(fk.GameStart, {
  can_refresh = function(self, event, target, player, data)
    return player:hasSkill(jiaowang.name, true) and not player:isKongcheng()
  end,
  on_refresh = function(self, event, target, player, data)
    for _, id in ipairs(player:getCardIds("h")) do
      player.room:setCardMark(Fk:getCardById(id), "@@rmt__jiaowang", 1)
    end
  end,
})

jiaowang:addEffect("maxcards", {
  exclude_from = function(self, player, card)
    return card and card:getMark("@@rmt__jiaowang") ~= 0 and player:hasSkill("rmt__jiaowang")
  end,
})


return jiaowang
